![require(esm) Backported to Node.js 20, Paving the Way for ESM-Only Packages](https://cdn.sanity.io/images/cgdhsj6q/production/be8ab80c8efa5907bc341c6fefe9aa20d239d890-1600x1097.png?w=400&fit=max&auto=format)
Security News
require(esm) Backported to Node.js 20, Paving the Way for ESM-Only Packages
require(esm) backported to Node.js 20, easing the transition to ESM-only packages and reducing complexity for developers as Node 18 nears end-of-life.
@saasquatch/component-environment
Advanced tools
Environment and contexts for SaaSquatch components
Provides the environment for running SaaSquatch web components.
SaaSquatch web components can run in a number of different environments, including:
squatch-js
squatch-android
)In each environment, a different set of context information about the tenant, user and program are provided, and the goal of this package is to normalize the differences in environments to provide a common API.
The environment is provided in a set of contexts through dom-context
, which provides vanilla global context providers. They can be accessed through a raw ContextListener
or via useDomContext
in dom-context-hooks
.
getEnvironment()
Get the environment type. The current possible values are: SquatchJS2
, SquatchAndroid
, SquatchPortal
, SquatchAdmin
or None
.
isDemo()
Returns whether components should run in demo/preview mode.
getTenantAlias()
Get the current tenant alias.
getAppDomain()
Get the SaaSquatch app domain.
getEngagementMedium()
Get the current engagement medium. This is particularly important in widgets rendered by squatch-js
for informing metadata about share link clicks.
The user identity context name is exported in a constant USER_CONTEXT_NAME
. The current value can be retrieved with getUserIdentity()
and set with setUserIdentity(identity)
.
The locale context name is exported in a constnat LOCALE_CONTEXT_NAME
. The current value can be retrieved with getLocale()
and set with setLocal(locale)
.
The program ID context name is exported in a constant PROGRAM_CONTEXT_NAME
. The current value can be retrieved with getProgramId()
and set with setProgramId(programId)
.
FAQs
Environment and contexts for SaaSquatch components
The npm package @saasquatch/component-environment receives a total of 156 weekly downloads. As such, @saasquatch/component-environment popularity was classified as not popular.
We found that @saasquatch/component-environment demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 11 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
require(esm) backported to Node.js 20, easing the transition to ESM-only packages and reducing complexity for developers as Node 18 nears end-of-life.
Security News
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.